2 the 9s
while 1:
	try:
		a=input()
		x=a
		if a=='0':
			break
		if int(a)%9!=0:
			print(str(a)+' is not a multiple of 9.')
		elif a=='9':
			print('9 is a multiple of 9 and has 9-degree 1.')
		else:
			c=0
			while int(a)>10:
				sum=0
				for i in str(a):
					sum+=int(i)
				c+=1
				a=sum
			print(str(x)+' is a multiple of 9 and has 9-degree '+str(c)+'.')
	except:
		break